﻿using System;
using System.Web.UI;
using BLL.A;
using Model.A;

public partial class ActiveProductTrace_ManageActiveProduct_ManageAllocateFYGESN_AllocateFYGESNAdd : System.Web.UI.Page
{
    private AllocateFYGESN apt;

    public ActiveProductTrace_ManageActiveProduct_ManageAllocateFYGESN_AllocateFYGESNAdd()
    {
        apt = new AllocateFYGESN();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string packageProductSN = this.TextBox1.Text.Trim();
        decimal holdovervalue = decimal.Parse(this.TextBox3.Text.Trim());
        AllocateFYGESNInfo apti = new AllocateFYGESNInfo(packageProductSN, DateTime.Now, holdovervalue, User.Identity.Name);
        try
        {
            apt.Insert(apti);
            string str = "记录成功！";
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "<script>alert('" + str + "');</script>", false);
            this.TextBox1.Text = "";
            this.TextBox3.Text = "";
            this.TextBox1.Focus();
        }
        catch
        {
            string str = "出现错误，请联系相关人员！";
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "click", "<script>alert('" + str + "');</script>", false);
        }
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        string packageProductSN = this.TextBox2.Text.Trim();
        this.GridView1.DataSource = apt.AllocateFYGESN_GetbySN(packageProductSN);
        this.GridView1.DataBind();
    }
}
